package com.tegistuff.webos.run.debugger.commands;

import com.tegistuff.webos.run.debugger.breakpoints.WebOSBreakpointWrapper;
import org.json.JSONException;

/**
 * WebOSRemoveBreakpointCommand.java
 *
 * Copyright (C) 2011-2012 Timo Tegtmeier.
 * All rights reserved.
 */
public class WebOSRemoveBreakpointCommand extends WebOSDebuggerCommand {

    private WebOSBreakpointWrapper myBreakpoint;

    public WebOSRemoveBreakpointCommand(WebOSBreakpointWrapper wrapper) {
        myBreakpoint = wrapper;
    }

    @Override
    public void execute() throws JSONException {
        runRequest(ourAppDebugSession.getClearBreakpointRequest(myBreakpoint.getBreakpointNumber()));
    }

    @Override
    protected void onSuccess() throws JSONException {
        ourDebugProcess.unregisterBreakpoint(myBreakpoint);
    }
}